FUNCTIONS: Functions are pieces of code that are defined once and called unlimited times to reuse them.

  • Click and watch the UFO. Let's use a function to abduct the cows one at a time! Look in .
  • Use Define Function above ufo.move_left(125) and name the function abduct().
  • Indent the next ten lines of code, up to and including beam.hide() , one time so they are in the function.
  • Use Function Call above each .hide() and change the function name to abduct(). Click Run!

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)